Skip to content

find: exclude a directory tree#16512

Closed
ronen1n wants to merge 4 commits intotldr-pages:mainfrom
ronen1n:patch-2
Closed

find: exclude a directory tree#16512
ronen1n wants to merge 4 commits intotldr-pages:mainfrom
ronen1n:patch-2

Conversation

@ronen1n
Copy link
Copy Markdown

@ronen1n ronen1n commented May 16, 2025

Why its faster:
-prune Stops Recursion: Once it reaches /mnt, it skips it entirely (including subdirectories).
-not -path Scans All Directories: It still traverses into /mnt before filtering, making it slower for large directories.

Excluding /mnt good for excluding win pc files in wsl and excluding external or other mounted drives

Examples:

find / -path '/mnt' -prune -o -name 'zellij' -type f 2>/dev/null

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented May 16, 2025

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions Bot added page edit Changes to an existing page(s). review needed Prioritized PRs marked for reviews from maintainers. labels May 16, 2025
@tldr-bot
Copy link
Copy Markdown

The build for this PR failed with the following error(s):

pages/common/find.md:0: TLDR019 Page should only include a maximum of 8 examples

Please fix the error(s) and push again.

Marged exclude options to one using prune
@sebastiaanspeck sebastiaanspeck changed the title Exclude a directory tree in find.md find: exclude a directorh tree May 17, 2025
@sebastiaanspeck sebastiaanspeck changed the title find: exclude a directorh tree find: exclude a directory tree May 17, 2025
@ronen1n ronen1n closed this by deleting the head repository May 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

page edit Changes to an existing page(s). review needed Prioritized PRs marked for reviews from maintainers.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants